<h1>{$module->getModuleName()}</h1>
<div class="wrap">
<div class="tree left">
	{if isset($tree)}
	
	<ul class="treeGroup">
	{defun name="rc" list=$tree} 
		{foreach from=$list item=item} 
		<li class="treeItem">
			<div class="opener left">
			{if $item->hasChildren}
				{if sizeof($item->children)}
					<a href="{url add="unload=`$item->id`" remove="load"}" onclick="expand({$item->id})">
						<img src="images/nolines_minus.gif" alt="-"/>
					</a>
				{else}	
					<a href="{url add="load=`$item->id`" remove="unload"}" onclick="expand({$item->id})">
						<img src="images/nolines_plus.gif" alt="+"/>
					</a>
				{/if}
			{else}
			&nbsp;
			{/if}
			</div>
			<div class="left item"> 
			<a href="{url remove="parent" add="mode=edit,id=`$item->id`"}">{$item->name}</a>
			<a href="{url add="mode=add,parent=`$item->id`" remove="id"}">+</a>
			
   			{if sizeof($item->children)}
   				<ul class="treeGroup">{fun name="rc" list=$item->children}</ul> 
  	 		{/if}
  	 		</div>
  	 		<div class="clear"></div>
		</li> 
		{/foreach}	 
	{/defun}	
	</ul>
	
	
	{/if}
	
	
	
</div>
{if isset($form)}
<div class="left objectOptions">
	
	<form class="defaultForm" action="{url add="mode=save"}" method="post" enctype="multipart/form-data">
		<input type="hidden" name="return" value="{url add="mode=edit"}" />
		
		{if isset($smarty.get.parent)}
			<input type="hidden" name="parent" value="{$smarty.get.parent}" />
		{else}
			<input type="hidden" name="parent" value="{$openedObject->parent}" />
		{/if}
		
		{foreach from=$form item=item}
			
			{assign var=name value=$item.name}
			<div class="formItem{if isset($error.$name)} error{/if}">
				{if is_array($item.field)}
					<fieldset>
						<legend>Object custom data</legend>
						{foreach from = $item.field item=field}
							<div>{$field.field}</div>
						{/foreach}
					</fieldset>
				{else}
				{$item.field}
				{/if}
			</div>
		{/foreach}
		<div class="">Url: {$openedObject->getUrl()}</div>
		<div class="oneField submit">
			<button type="submit">Save{if isset($smarty.get.id)} changes{/if}</button> <a class="fromCancelLink" href="{url remove="id,mode"}">Cancel</a>
		</div>
		
	</form>
{if sizeof($module->assign.openedObject->id)}
<div class="deleteObject">
	Delete this Content tree.
	<form action="{url add="mode=delete"}" method="post" onsubmit="return confirm('Sure to delete this Content tree?');">
		<input type="hidden" name="return" value="{url remove="id,mode"}" />
		<input type="hidden" name="id" value="{$module->assign.openedObject->id}" />
		<button type="submit">Delete</button>
	</form>
</div>
{/if}
</div>
{/if}
<div class="clear"></div>
</div>